#include "../unp.h"

int
sock_get_port(const struct sockaddr *sa, socklen_t salen)
{
    switch (sa->sa_family) {
        case AF_INET: {
            struct sockaddr_in	*sin = (struct sockaddr_in *) sa;
            return(sin->sin_port);
        }
    }
    return(-1);	
}